Numerical Literal in Code (NLC)

Description:

It is suggested to replace literal numbers with symbolic constants. It is acceptable to hard code -1, 0, and 1.

Incorrect:

double PotentialEnergy(double mass, double height) {
    return mass * 9.81 * height;
}

Correct:

private const double G = 9.81;

double PotentialEnergy(double mass, double height) {
    return mass * G * height;
}

Refactoring: